from flask import render_template, Blueprint
from markupsafe import Markup

from applications.common.curd import get_one_by_id
from applications.models import Article

index_bp = Blueprint('Index', __name__, url_prefix='/')


@index_bp.route('/<int:id>')
def index(id):
    res = get_one_by_id(Article, id)
    res.remark = Markup(res.remark)
    ass = Article.query.all()

    return render_template("index/112.html", res=res,ass=ass[0].categorys.category_name)


@index_bp.route('/')
def getindex():
    return render_template("index/index.html")
